#include "plc2llvm/PLCScopeStack.h"
#include <iostream>

PLCScopeStack* PLCScopeStack::plcStack = new PLCScopeStack();

PLCScope *PLCScopeStack::getTopScope() {
    return PLCScopeStack::plcStack->scopeStack.top();
}

void PLCScopeStack::pop() {
    PLCScopeStack::plcStack->scopeStack.pop();
}

void PLCScopeStack::push(PLCScope *scope) {
    PLCScopeStack::plcStack->scopeStack.push(scope);
}

PLCScopeStack::PLCScopeStack() {
    this->globalScopeInit();
}

void PLCScopeStack::globalScopeInit() {
    this->globalScope = new PLCScope();
    this->scopeStack.push(globalScope);

    //TODO: add build in types
}

PLCScopeStack *PLCScopeStack::getScopeStack() {
    return PLCScopeStack::plcStack;
}

PLCScopeStack::~PLCScopeStack() {
    delete this->globalScope;
}
